package generator.domain;

import java.time.LocalDateTime;
import lombok.Data;

/**
 * 
 * @TableName test_questions
 */
@Data
public class TestQuestions {
    /**
     * 
     */
    private Integer id;

    /**
     * 所属测试ID（原外键，现保留字段）
     */
    private Integer testId;

    /**
     * 题干内容
     */
    private String questionText;

    /**
     * 题型
     */
    private Object questionType;

    /**
     * 选项列表（选择题）
     */
    private Object options;

    /**
     * 题目顺序
     */
    private Integer orderNum;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TestQuestions other = (TestQuestions) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTestId() == null ? other.getTestId() == null : this.getTestId().equals(other.getTestId()))
            && (this.getQuestionText() == null ? other.getQuestionText() == null : this.getQuestionText().equals(other.getQuestionText()))
            && (this.getQuestionType() == null ? other.getQuestionType() == null : this.getQuestionType().equals(other.getQuestionType()))
            && (this.getOptions() == null ? other.getOptions() == null : this.getOptions().equals(other.getOptions()))
            && (this.getOrderNum() == null ? other.getOrderNum() == null : this.getOrderNum().equals(other.getOrderNum()))
            && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTestId() == null) ? 0 : getTestId().hashCode());
        result = prime * result + ((getQuestionText() == null) ? 0 : getQuestionText().hashCode());
        result = prime * result + ((getQuestionType() == null) ? 0 : getQuestionType().hashCode());
        result = prime * result + ((getOptions() == null) ? 0 : getOptions().hashCode());
        result = prime * result + ((getOrderNum() == null) ? 0 : getOrderNum().hashCode());
        result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", testId=").append(testId);
        sb.append(", questionText=").append(questionText);
        sb.append(", questionType=").append(questionType);
        sb.append(", options=").append(options);
        sb.append(", orderNum=").append(orderNum);
        sb.append(", createdAt=").append(createdAt);
        sb.append("]");
        return sb.toString();
    }
}